<?php
class ParametersController extends AppController
{
	var $name ="Parameters";
	var $helpers = array('Html','Ajax','Javascript','Form');
 	var $paginate = array(
        'limit' =>10,
        'order' => array('Parameter.name' => 'asc')
    );
	
	function index($id=null){
		$this->layout = "home";	
		$this->Parameter->id = $id;
		$this->set('parameter',$this->Parameter->read());
		$data = $this->paginate('Parameter');
		$this->set('parameterList',$data);
		
	}
	function save(){
		$id= $_REQUEST['id'];
		$name = $_REQUEST['name'];
		$description = $_REQUEST['description'];
		if($id !="" && $id !=null){
			$this->Parameter->set('id',$id);
			$this->Parameter->set('name',$name);
			$this->Parameter->set('description',$description);
			$this->Parameter->save();
			}
			else {
				$this->Parameter->create();
				$this->Parameter->set('name',$name);
				$this->Parameter->set('description',$description);
				$this->Parameter->saveAll();
			}
			$this->redirect(array('action' => "index"));
	}
	function delete(){
	$id = $_REQUEST['id'];
	if($id !=null && $id !=""){
		$this->Parameter->delete($id);
		$this->redirect(array('action'=>'index'));
	}
}
}
?>